<template>
    <h1>hook练习</h1>
    <div>{{ formatted  }}</div>
    <div>{{ timeAgo }}</div>
</template>
<script setup >
    // 时间hook
    import { useDateFormat, useNow } from '@vueuse/core'
    import { useTimeAgo } from '@vueuse/core'
    const formatted = useDateFormat(useNow(), 'YYYY-MM-DD HH:mm:ss')
    console.log(formatted.value);
    console.log(useNow().value);
    const timeAgo = useTimeAgo(new Date(2021, 0, 1))
</script>
<style scoped lang='less'>
</style>
